package com.ty.service.impl;

import com.ty.bean.Dict;
import com.ty.common.crud.BaseServiceImpl;
import com.ty.mapper.DictMapper;
import com.ty.service.DictService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class DictServiceImpl extends BaseServiceImpl<Dict, DictMapper> implements DictService {

    @Override
    public List<Map> query(int pid) {
        return baseMapper.query(pid);
    }


    @Override
    public List queryChild(String code) {
        return baseMapper.queryChild(code);
    }

    @Override
    public Map queryChilds(String[] codes) {
        //存放结果
        Map result = new HashMap();
        if (null == codes || codes.length == 0) return result;
        //遍历
        for (String code : codes) {
            //根据编码查询
            List list = baseMapper.queryChild(code);
            result.put(code, list);
        }
        return result;
    }
}